﻿using System.Windows.Forms;

namespace ruscehproj2
{
    public partial class br003 : Form
    {
        bool isActive = false;
        bool powered = false;
        byte modeState = 1;
        double angle = 45;

        public bool getState()
        {
            return isActive;
        }

        public br003()
        {
            InitializeComponent();
        }

        private void br003_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Hide();
            }
        }

        private void br003_Load(object sender, System.EventArgs e)
        {
            if (FormManager.hlp.helpEnabled())
            {
                if (FormManager.br41.getState())
                {
                    if (isActive)
                    {
                        FormManager.hlp.setHelpId("end");
                    }
                    else FormManager.hlp.setHelpId("vkl");
                    FormManager.hlp.hlpRefresh();
                }
                else
                {
                    FormManager.hlp.notSoFast();
                }

                //voltmetr1.r = 150;

                FormManager.hlp.Show();
            }
        }

        private void br003_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (isActive) FormManager.hlp.setHelpId("28");
            FormManager.hlp.Hide();
        }

        private void mode_Click(object sender, System.EventArgs e)
        {
            if (powered)
            {
                if (modeState > 5)
                {
                    modeState = 0;
                    isActive = true;
                    //FormManager.hlp.setHelpId("end");
                    MessageBox.Show("РЛС Включена!");
                }
                modeState++;
                switch (modeState)
                {
                    case 1: mode.BackgroundImage = Resources.set3; angle = 45; break;
                    case 2: mode.BackgroundImage = Resources.set4; angle = 120; break;
                    case 3: mode.BackgroundImage = Resources.set5; angle = 110; break;
                    case 4: mode.BackgroundImage = Resources.set6; angle = 100; break;
                    case 5: mode.BackgroundImage = Resources.set7; angle = 92; break;
                    case 6: mode.BackgroundImage = Resources.set8; angle = 80; break;
              
                }
                FormManager.hlp.hlpRefresh();
            }
        }

        private void vkl_Click(object sender, System.EventArgs e)
        {
            if (FormManager.br41.getState())
            {
                powered = true;
                FormManager.hlp.setHelpId("25");
                FormManager.hlp.hlpRefresh();
            }
        }

       
    }
}
